<html>
<head><meta charset="utf-8"><title>vscode and Miri · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/vscode.20and.20Miri.html">vscode and Miri</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="209232085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/vscode%20and%20Miri/near/209232085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/vscode.20and.20Miri.html#209232085">(Sep 06 2020 at 16:33)</a>:</h4>
<p>I am trying to get vscode to work properly with Miri. The tricky part is that Miri consists of two (independent) crates, but is not a workspace because that wouldn't work with it also being part of the rustc workspace. So (and also for other reasons) I have a <code>./miri</code> script somewhat similar to <code>./x.py</code>. I configured vscode to use that script:</p>
<div class="codehilite"><pre><span></span><code>    &quot;rust-analyzer.checkOnSave.overrideCommand&quot;: [
        &quot;./miri&quot;,
        &quot;check&quot;,
        &quot;--message-format=json&quot;,
    ],
</code></pre></div>


<p>when I run this on the command-line, it works fine -- at least there is lots of JSON and some of it looks like the error message I am expecting. But in vscode, it doesn't show error for <code>cargo-miri</code> (the crate that is in a subfolder). It does show errors for the "root" crate -- almost as if it would ignore my command?<br>
I am not sure how to debug this. I found a thing called "extension debug log folder" and in there I found this</p>
<div class="codehilite"><pre><span></span><code>[ERROR rust_analyzer::main_loop] File with cargo diagnostic not found in VFS: file not found: /home/r/src/rust/miri/bin.rs
</code></pre></div>


<p>but I am not sure if that has any significance. The error JSON does not refer to that file; there's a <code>cargo-miri</code> subfolder that is missing:</p>
<div class="codehilite"><pre><span></span><code>{&quot;reason&quot;:&quot;compiler-message&quot;,&quot;package_id&quot;:&quot;cargo-miri 0.1.0 (path+file:///home/r/src/rust/miri/cargo-miri)&quot;,&quot;target&quot;:{&quot;kind&quot;:[&quot;bin&quot;],&quot;crate_types&quot;:[&quot;bin&quot;],&quot;name&quot;:&quot;cargo-miri&quot;,&quot;src_path&quot;:&quot;/home/r/src/rust/miri/cargo-miri/bin.rs&quot;,&quot;edition&quot;:&quot;2018&quot;,&quot;doctest&quot;:false,&quot;test&quot;:false},&quot;message&quot;:{&quot;rendered&quot;:&quot;For more information about an error, try `rustc --explain E0069`.\n&quot;,&quot;children&quot;:[],&quot;code&quot;:null,&quot;level&quot;:&quot;failure-note&quot;,&quot;message&quot;:&quot;For more information about an error, try `rustc --explain E0069`.&quot;,&quot;spans&quot;:[]}}
</code></pre></div>


<p>Any idea why vscode does not show inline errors for cargo-miri?<br>
Cc <span class="user-mention" data-user-id="133169">@matklad</span></p>



<a name="209775099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/vscode%20and%20Miri/near/209775099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/vscode.20and.20Miri.html#209775099">(Sep 11 2020 at 12:42)</a>:</h4>
<p>I am unlikely to look into this for a couple of weeks, but I'll try not to forget to come back to it.</p>



<a name="209775120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/vscode%20and%20Miri/near/209775120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/vscode.20and.20Miri.html#209775120">(Sep 11 2020 at 12:42)</a>:</h4>
<p>My <em>guess</em> would be that JSON messages contain relative paths</p>



<a name="209775136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/vscode%20and%20Miri/near/209775136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/vscode.20and.20Miri.html#209775136">(Sep 11 2020 at 12:42)</a>:</h4>
<p>And those paths are relative to different dirs for two crates</p>



<a name="209775151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/vscode%20and%20Miri/near/209775151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/vscode.20and.20Miri.html#209775151">(Sep 11 2020 at 12:42)</a>:</h4>
<p>So one of them works and the other doesn't</p>



<a name="209775214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/vscode%20and%20Miri/near/209775214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/vscode.20and.20Miri.html#209775214">(Sep 11 2020 at 12:43)</a>:</h4>
<p>No quick hack to fix this comes to mind unfortunately  :(</p>



<a name="209871428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/vscode%20and%20Miri/near/209871428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/vscode.20and.20Miri.html#209871428">(Sep 12 2020 at 08:38)</a>:</h4>
<p><span class="user-mention" data-user-id="133169">@matklad</span>  that was my guess, too, but <code>src_path</code> is absolute in the JSON I quoted above.</p>



<a name="209871434"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/vscode%20and%20Miri/near/209871434" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/vscode.20and.20Miri.html#209871434">(Sep 12 2020 at 08:38)</a>:</h4>
<p>I also reported this in the bugtracker now: <a href="https://github.com/rust-analyzer/rust-analyzer/issues/5962">https://github.com/rust-analyzer/rust-analyzer/issues/5962</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>